<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ page session="false"%>
<html>
<head>
<title>Change Password Page</title>
</head>
<body>
	<script type="text/javascript" src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
	<script type="text/javascript">
		function checkPassword() {
			var oldPassDB = $('#oldPasswordDB').val();
			var oldPass = $('#oldPassword').val();
			var newPass = $('#newPassword').val();
			var confirmPass = $('#confirmPassword').val();
			var error = false;
			if (oldPassDB != oldPass) {
				error = true;
				alert("Wrong old password!");
			}
			if (newPass != confirmPass) {
				error = true;
				alert("Password is not matched!")
			}
			if (!error) {
				var form = $('#formChangePassword');
				form.submit();
			}
		}
	</script>
	<div align="center" style="padding-top: 50px;">
		<h1>Change Password</h1>
		<form method="POST" id="formChangePassword">
			<input type="hidden" value="${userUpdate.password}" id="oldPasswordDB">
			<table style="font-size: 15pt">
				<tbody>
					<tr>
						<td>User Name</td>
						<td>${userUpdate.username}</td>
					</tr>
					<tr>
						<td>Old Password</td>
						<td><input type="password" name="oldPasswordtxt" id="oldPassword"/></td>
					</tr>
					<tr>
						<td>New Password</td>
						<td><input type="password" name="newPasswordtxt" id="newPassword"/></td>
					</tr>
					<tr>
						<td>Confirm Password</td>
						<td><input type="password" name="conPasswordtxt" id="confirmPassword"/></td>
					</tr>
					<tr>
						<td colspan="2" style="text-align: right; padding-top: 10px;">
							<input type="button" name="createPMbtn" value="Submit" onclick="checkPassword();" />
						</td>
					</tr>
				</tbody>
			</table>
		</form>
	</div>
</body>
</html>
